//
//  CallApplyCell.m
//  Molian
//
//  Created by wansong on 4/13/15.
//  Copyright (c) 2015 xiaocan. All rights reserved.
//

#import "CallApplyCell.h"


@implementation CallApplyCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        CGFloat cellHeight = 60;
        
        self.accessoryType = UITableViewCellAccessoryNone;
        
        // 用户头像
        self.avatarImgView = [[UIImageView alloc]init];
        self.avatarImgView.frame = CGRectMake(10, (cellHeight-50)/2, 50, 50);
        self.avatarImgView.layer.masksToBounds = YES;//开启圆角
        [self.avatarImgView.layer setCornerRadius:5.0f];
        [self.avatarImgView setContentMode:UIViewContentModeScaleAspectFill];
        [self.contentView addSubview:self.avatarImgView];
        
        // 用户名字
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.frame = CGRectMake(80, 15, DeviceWidth-180, 15);
        self.nameLabel.font = [UIFont fontWithName:FontName size:15];
        self.nameLabel.textColor = [UIColor blackColor];
        self.nameLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:self.nameLabel];
        
        // 用户年龄
        self.ageLabel = [[UILabel alloc]init];
        self.ageLabel.frame = CGRectMake(80, 40, 22, 12);
        self.ageLabel.font = [UIFont fontWithName:FontName size:11];
        [self.ageLabel.layer setCornerRadius:6];
        self.ageLabel.clipsToBounds = YES;
        self.ageLabel.textAlignment = NSTextAlignmentCenter;
        self.ageLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.ageLabel];
        
        // 位置
        self.locationLabel = [[UILabel alloc]init];
        self.locationLabel.frame = CGRectMake(110, 40, 90, 12);
        self.locationLabel.font = [UIFont fontWithName:FontName size:11];
        self.locationLabel.textAlignment = NSTextAlignmentLeft;
        self.locationLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.locationLabel];
        
        // 愿意按钮
        self.acceptBtn = [[UIButton alloc]init];
        self.acceptBtn.frame = CGRectMake(DeviceWidth-70, 15, 60, 30);
        self.acceptBtn.layer.masksToBounds = YES;
        [self.acceptBtn.layer setCornerRadius:15.0f];
        self.acceptBtn.titleLabel.font = [UIFont fontWithName:FontName size:14];
        [self.acceptBtn setTitle:@"我愿意" forState:UIControlStateNormal];
        [self.acceptBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.acceptBtn setBackgroundColor:UIColorFromRGB(0xfb7389)];
        [self.contentView addSubview:self.acceptBtn];
        
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end
